package com.mall.common.utils;

import java.util.Random;

/**
 * @author xyl
 * @date 2021-02-16 17:59
 */
public class RandomUtil {

    public static  String generateVerifyCode(int verifySize) {
        String codes = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
        int codesLen = codes.length();
        Random rand = new Random(System.currentTimeMillis());
        StringBuilder verifyCode = new StringBuilder(verifySize);
        for (int i = 0; i < verifySize; i++) {
            verifyCode.append(codes.charAt(rand.nextInt(codesLen - 1)));
        }
        return verifyCode.toString();
    }
}
